﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace OpenAdmin.Database.Migrations.MultiTenancyDbContexts
{
    public partial class Initail : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Tenant",
                columns: table => new
                {
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Email = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PhoneNumber = table.Column<string>(type: "varchar(32)", maxLength: 32, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConnectionString = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    CreatedTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Tenant", x => x.TenantId);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.InsertData(
                table: "Tenant",
                columns: new[] { "TenantId", "ConnectionString", "CreatedTime", "Email", "Enabled", "Name", "PhoneNumber", "Remark" },
                values: new object[] { new Guid("be066e77-c7a8-9181-5e9d-5457acd286bf"), null, new DateTimeOffset(new DateTime(2022, 12, 18, 10, 13, 22, 827, DateTimeKind.Unspecified).AddTicks(9786), new TimeSpan(0, 0, 0, 0, 0)), "superAdmin@163.com", true, "平台租户", "13680398478", "平台租户" });

            migrationBuilder.InsertData(
                table: "Tenant",
                columns: new[] { "TenantId", "ConnectionString", "CreatedTime", "Email", "Enabled", "Name", "PhoneNumber", "Remark" },
                values: new object[] { new Guid("d4bb6bca-0da1-bfed-7df5-209f09641aef"), null, new DateTimeOffset(new DateTime(2022, 12, 18, 10, 13, 22, 827, DateTimeKind.Unspecified).AddTicks(9807), new TimeSpan(0, 0, 0, 0, 0)), "johnny@163.com", true, "企业租户01", "13680398456", "企业租户" });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Tenant");
        }
    }
}
